<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<script type="text/javascript">
<!--

//-->

function CheckCheckAll(Check_ctr) {
	chk = document.getElementsByName('selectedCategory');
	if (Check_ctr.checked == true) {
		chk.checked = true;
		for (i = 0; i < chk.length; i++) {
			chk[i].checked = true;
		}
	} else {
		chk.checked = false;
		for (i = 0; i < chk.length; i++) {
			chk[i].checked = false;
		}
	}
}

function deleteSearch() {
	var flag = false;
	chk = document.getElementsByName('selectedCategory');
	for (i = 0; i < chk.length; i++) {
		if(chk[i].checked == true) {
			flag = true;
			break;
		}
	}

	if(flag) {
		return wantToDelete('Want to delete selected searches?');
	} else {
		alert('Select at least one search to delete...');
		return false;
	}
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td>
			<div class="blue-text16" style="margin: 0px 0px 0px 0px">
				<table width="100%">
					<tr>
						<td class="heding" align="left">
							<s:text name="favouritesearch.myfavouritesearch" />
						</td>
						<td align="left">
							<a href="addToFavoriteSearches.htm" class="common-link"><s:text name="addSearchToFavorite.favoriteSearch" /></a>
						</td>
					</tr>
				</table>
			</div>
			<div class="header-separator-bg" style="margin: 10px 5px 17px 0px"></div>
			<div style="margin: 0px 0px 12px 0px">
				<s:form action="deleteMultiFavoriteSearches.htm" theme="simple" method="post" onsubmit="return deleteSearch()">
					<table border="0" cellpadding="0" cellspacing="0" width="100%">
						<tbody>
							<tr>
								<td width="100%">
									<table border="0" cellpadding="0" cellspacing="0" width="100%">
										<tbody>
											<display:table name="favoritesSearchList" pagesize="10"
												requestURI="favoriteSearches.htm" id="row" >
												<display:column title="<input type='checkbox' name='selectall' onclick='CheckCheckAll(this)' />" style="width: 5%" class="grid-bg common-text" headerClass="grid-header-bg grid-header-text-link">
													<s:checkbox name="selectedCategory" theme="simple"
														fieldValue="%{#attr.row.id}" />
												</display:column>
												<display:column title="Name of search" style="width: 35%" class="grid-bg common-text" headerClass="grid-header-bg grid-header-text-link">
													<a href="browseItems.htm?titleValue=${row.name}&city=${row.location}&locations=${row.regionId.categoryId}&cid=${row.categoryId.categoryId}"  /><s:property value="#attr.row.name" /></a>
												</display:column>
												<display:column property="title" title="Search criteria" style="width: 35%" class="grid-bg common-text" headerClass="grid-header-bg grid-header-text-link" />
												<display:column title="Email settings" property="mailStatus" style="width: 5%" class="grid-bg common-text" headerClass="grid-header-bg grid-header-text-link" />
												<display:column title="Type" property="type.type" style="width: 10%" class="grid-bg common-text" headerClass="grid-header-bg grid-header-text-link" />
												<display:column autolink="true" title="Options" style="width: 10%" class="grid-bg common-text" headerClass="grid-header-bg grid-header-text-link">
													<table>
														<tr>
															<td align="center" valign="top" class="grid-bg common-text" id="mddm" width="10%">
															<a class="mddm" href="#" onmouseover="mopen('<s:property value="%{#attr.row.id}"/>', this, 'common-link', 'right', 1)"
																onmouseout="mclosetime()">Select</a>
																<div style="visibility: hidden;" id="<s:property value="%{#attr.row.id}"/>"
																	onmouseover="mcancelclosetime()"
																	onmouseout="mclosetime()">
									                                <s:a href="editFavoriteShops.htm?uid=%{#attr.row.id}" cssClass="btn-grey-link">Edit </s:a>
									                                <a href="#" class="btn-grey-link">Email Settings</a>
									                                <s:a href="javascript: wantToDeleteWithURL('deleteFavoriteSearch.htm?uid=%{#attr.row.id}', 'Do you want to delete this search?')" cssClass="btn-grey-link">Delete </s:a>
																<s:if test="#attr.row.note != null && #attr.row.note != ''">
																	<s:a href="addEditNoteToFavoriteSearch.htm?fuid=%{#attr.row.id}">Edit Note</s:a>
																</s:if>
																<s:else>
																	<s:a href="addEditNoteToFavoriteSearch.htm?fuid=%{#attr.row.id}">Add Note</s:a>
																</s:else>
																     <a href="#" class="btn-grey-link">Time: ending soonest </a>
									                                 <a href="#" class="btn-grey-link">Time: newly listed </a>
																     <a href="#" class="btn-grey-link">Time: ending today </a>
																     <a href="#" class="btn-grey-link">Time: new today</a>
																     <a href="#" class="btn-grey-link">Create a wanted</a>
															    </div>
															</td>
														</tr>
													</table>
												</display:column>
												<display:column>
													<tr>
														<td colspan="6" bgcolor="#ffffdd">
															<c:out value="${row.note}"></c:out>
														</td>
													</tr>
												</display:column>
											</display:table>
											<tr>
												<td width="100%">
												<div style="margin:0px 8px 0px 0px">
												<table border="0" cellspacing="0" cellpadding="0">
								                    <tr>
								                      	<td><img src="images/middle/btn-grey-left1.gif" alt=" " width="6" height="23" /></td>
								                      	<td class="btn-grey-middle1 "><s:submit name="delete" value="delete" align="left" theme="simple" cssClass="submit-btn-common" /></td>
														<td><img src="images/middle/btn-grey-right1.gif" alt=" " width="6" height="23" /></td>
                    								</tr>
                  								</table>
												</div>
												</td>
											</tr>
										</tbody>
									</table>
								</td>
							</tr>
						</tbody>
					</table>
				</s:form>
			</div>
		</td>
	</tr>
</table>